/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小梅就是酱子
 * Date: 2022-01-26
 * Time: 16:08
 */
public class 递归求N的阶乘 {
    public static void main(String[] args) {
        int n=5;
        int ret=factor(n);
        System.out.println("ret="+ret);
    }
    public static int factor(int n){
        if(n==1){
            return 1;
        }
        return n*factor(n-1);//factor调用函数自身
    }
}
